﻿{{include 'admin/public/header.html'}}


<div class="main-container" id="main-container">
	<div class="main-container-inner">

		{{include 'admin/public/nav.html'}}


		<div class="main-content">


			<div class="page-content">

				<div class="page-header">
					<h1>
						设备列表
					</h1>
				</div>

				{{if deviceList.length>0}}

				<!--表格-->

				<div class="table-responsive">
					<table id="sample-table-1" class="table table-striped table-bordered table-hover center">
						<thead>
							<tr>

								<th class="center">设备名称</th>
								<th class="center"> 设备ID </th>
								<th class="center"> 流名称 </th>
								<th class="center"> 封面图 </th>

								<th class="center">
									<i class="icon-time bigger-110 hidden-480"></i>
									过期时间
								</th>
								<th class="center">状态</th>

								<th width="80px;" class="center">操作</th>
							</tr>
						</thead>

						<tbody>

							{{each deviceList}}
							<tr>


								<td>
									{{$value.device_name}}
								</td>

								<td>
									{{$value.device_id}}
								</td>

								<td>
									{{$value.stream_name}}
								</td>
								<td>
									<img src="/{{$value.device_pic}}" alt="" style="width:60px" />
								</td>

								<td>

									{{if $value.expires_time}}
									{{$value.expires_time | dateFormat}}
									{{/if}}
								</td>

								<td class="hidden-480">
									{{if $value.expires_time>nowDate}}
									<span class="blue">可用</span>
									{{else}}
									<span class="red">不可用-已过期</span>
									{{/if}}
								</td>

								<td width="180">
									<a class="btn btn-success btn-xs" href="/admin/device/show?id={{@$value._id}}"><i
											class="lnr lnr-eye"></i> 查看</a>
									<a class="btn btn-primary btn-xs" style="margin-left:5px;"
										href="/admin/device/edit?id={{@$value._id}}">编辑</a>
									<a class="btn btn-danger btn-xs" style="margin-left:5px;"
										onclick="return confirm('删除后无法恢复，确认删除？');"
										href="/admin/device/delete?id={{@$value._id}}">删除</a>
								</td>
							</tr>

							{{/each}}
						</tbody>
					</table>
					<div id="page" class="pagination"></div>
				</div>
				{{else}}
					<p>您还没有任何设备信息、请点击  <a href="/admin/device/add">增加设备+</a></p>
				{{/if}}
			</div>
		</div><!-- /.main-content -->

	</div><!-- /.main-container-inner -->

</div><!-- /.main-container -->

<script src="{{__ROOT__}}/admin/js/jquery-2.0.3.min.js"></script>
<script src="{{__ROOT__}}/admin/js/jqPaginator.js"></script>

<script>

	$(function(){

		$('#page').jqPaginator({
			totalPages: {{totalPages}},
			visiblePages: 8,
			currentPage: {{page}},
			onPageChange: function (num, type) {
				if(type=='change'){
					location.href="/admin/device?page="+num;
				}
			}
		})
	})

</script>
</body>

</html>